﻿namespace DesignModeConsole.结构型.装饰器模式;

public class LogWrapper : Log
{
    private readonly Log _log;

    public LogWrapper(Log log)
    {
        _log = log;
    }

    public override void Write(string log)
    {
        _log.Write(log);
    }
}

public class LogErrorWrapper : LogWrapper
{
    public LogErrorWrapper(Log log) : base(log)
    {
    }

    public override void Write(string log)
    {
        SetError();

        base.Write(log);
    }

    public void SetError()
    {
        Console.WriteLine("记录错误严重级别");
    }
}

public class LogPriorityWrapper : LogWrapper
{
    public LogPriorityWrapper(Log log) : base(log)
    {
    }

    public override void Write(string log)
    {
        SetPriority();

        base.Write(log);
    }

    public void SetPriority()
    {
        Console.WriteLine("记录优先级别");
    }
}